package com.qf.service.impl;

import com.qf.dao.MyProductsDao;
import com.qf.dao.impl.MyProductsDaoImpl;
import com.qf.entity.MyProducts;
import com.qf.entity.Products;
import com.qf.service.MyProductsService;

import java.util.List;

public class MyProductsServiceImpl implements MyProductsService {

    private MyProductsDao dao = new MyProductsDaoImpl();

    @Override
    public List<MyProducts> findByUid(int uid) {
        return dao.selectByUid(uid);
    }

    @Override
    public boolean addProByUid(MyProducts products) {
        int res = dao.insertProByUid(products);
        if (res >= 0){
            return true;
        }
        return false;
    }

    @Override
    public MyProducts findByID(int id) {
        return dao.selectByID(id);
    }

    @Override
    public boolean editMproByID(double myNum, double myAmount, int id) {
        int res = dao.updateMyProByID(myNum,myAmount,id);
        if (res >= 0){
            return true;
        }
        return false;
    }
}
